/* Given four points in a 2-D coordinate system, we are required to find 
 * a point P that minimizes the sum of distances to these four points. 
 * If the four points form a strictly convex quadrilateral, then P is the
 * crossing point of the diagonals of the quadrilateral. Otherwise, if the
 * quadrilateral is concave or degenerate, P is one of the vertices.
 */

#include <stdio.h>
#if 0
#include "geometry.h"
#else
#include <math.h>

typedef struct { double x, y; } Point[1];
typedef struct { double a, b, c; } Line[1];

/* Makes a line that passes through two points. */
void make_line(Line L, const Point P1, const Point P2)
{
    L->a = P1->y - P2->y;
    L->b = P2->x - P1->x;
    L->c = -L->a * P1->x - L->b * P1->y;
}

/* Intersects two lines and stores the crossing point in P.
 * Returns 1 if there is a unique crossing point; otherwise 0.
 */
int intersect_lines(const Line L1, const Line L2, Point P[])
{
    double a1 = L1->a, b1 = L1->b, c1 = L1->c;
    double a2 = L2->a, b2 = L2->b, c2 = L2->c;
    double det = a1*b2 - a2*b1;
    double p = b1*c2 - b2*c1;
    double q = a2*c1 - a1*c2;

    if (det == 0) /* parallel or overlapping */
        return 0;

    P[0]->x = p / det;
    P[0]->y = q / det;
    return 1;
}

/* Returns the Euclidean distance between two points. */
double distance(const Point P1, const Point P2)
{
    double dx = P1->x - P2->x;
    double dy = P1->y - P2->y;
    return sqrt(dx * dx + dy * dy);
}

/* Returns the sum of Euclidean distance between two sets of points. */
double sum_distance(const Point P1[], size_t n1, const Point P2[], size_t n2)
{
    double d = 0.0;
    size_t i, j;
    for (i = 0; i < n1; i++)
        for (j = 0; j < n2; j++)
            d += distance(P1[i], P2[j]);
    return d;
}

/* Finds the geometric median of four points, which is a point that minimizes
 * the total distance to the four points. Returns this minimum.
 */
double geometric_median(const Point P[4], Point M)
{
    double min_d = -1.0, d;
    int i;

    for (i = 0; i < 4; i++)
    {
        if ((d = sum_distance(&P[i], 1, P, 4)) < min_d || min_d < 0)
        {
            min_d = d;
            *M = *P[i];
        }
    }

    for (i = 0; i < 3; i++)
    {
        Line L1, L2;
        Point M2;
        make_line(L1, P[3], P[i]);
        make_line(L2, P[(i+1)%3], P[(i+2)%3]);
        if (intersect_lines(L1, L2, &M2) == 1)
            if ((d = sum_distance(&M2, 1, P, 4)) < min_d)
            {
                min_d = d;
                *M = *M2;
            }
    }
    
    return min_d;
}
#endif

int main()
{
    Point P[4], M;
    while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf", 
        &P[0]->x, &P[0]->y, &P[1]->x, &P[1]->y, 
        &P[2]->x, &P[2]->y, &P[3]->x, &P[3]->y) == 8 && P[0]->x >= 0)
    {
        printf("%.4lf\n", geometric_median(P, M));
    }
    return 0;
}
